﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DoubleH.Utility.Configuration;

namespace DoubleH.Utility
{
    public partial class FormPrint : Form
    {
        public FormPrint()
        {
            InitializeComponent();
        }

        DoubleH.Utility.Configuration.PrintConfig config = null;
        Int64 cors = -1;
        public void Init(object corSId,DoubleH.Utility.Configuration.PrintConfig obj)
        {
            this.config = obj;
            if (corSId != null)
                cors = (Int64)corSId;
        }


        private void toolStripButtonPrint_Click(object sender, EventArgs e)
        {
            webBrowser1.Print();
        }

        private void toolStripButtonPrintDialog_Click(object sender, EventArgs e)
        {
            webBrowser1.ShowPrintDialog();
        }

        private void toolStripButtonMail_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(DoubleHConfig.UserConfig.EmailSmtp) || string.IsNullOrEmpty(DoubleHConfig.UserConfig.EmailName) || string.IsNullOrEmpty(DoubleHConfig.UserConfig.EmailPwd))
            {
                MessageWindow.Show("邮件配置错误");
                return;
            }
            WindowEmail we = new WindowEmail();
            we.Init(cors,webBrowser1.DocumentText);
            we.ShowDialog();
        }

        private void toolStripButtonConfig_Click(object sender, EventArgs e)
        {
            PrintConfig cf = new PrintConfig();
            cf.Init(config);
            cf.ShowDialog();
        }

        private void toolStripButtonExport_Click(object sender, EventArgs e)
        {

        }
    }
}
